package com.kaifamiao.define;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;

@WebServlet( "/general/*" )
public class GeneralServlet extends HttpServlet {

    private final Logger logger = Logger.getLogger( this.getClass().getName() );

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        // 获取本次请求时使用的请求方式
        String method = request.getMethod();
        // 获取请求路径
        String uri = request.getRequestURI();

        logger.info( method + " : " + uri  );

        response.setContentType( "text/html; charset=UTF-8" );
        PrintWriter out = response.getWriter();
        out.println( "<h3>" + method + "</h3>" );

    }

}
